<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>
<body>
    <div id="root">
       <h1>欢迎来到{{name}}联盟</h1>
       <button v-on:click="showinfo">点击1</button>
       <!-- v-on:的简写是@ -->
       <!-- 因为只要传参数就会把event顶掉，所以在vue中可以用$event来传入event -->
       <button @click="showinfo2(66,$event)">点击2</button>

       <!-- 如果内容简单也可以不需要函数 -->
       <!-- <button @click="n++">点我n加一</button> -->
    </div>
</body>
<script>
    Vue.config.productionTip = false;
    const vm = new Vue({
        el:'#root',
        data:{
           name:"德莱"
        },
        methods: {
            showinfo:function(){
                // 此处的this是vm或者组件实例对象，就是实例对象本身，箭头函数的话就是window
                alert("你好")
            },
            showinfo2:function(num,event){

                console.log(event)
                alert("你好"+num)
            }
        },
    })
</script>
</html>